package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type MembershipLevelUpdateLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMembershipLevelUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MembershipLevelUpdateLogic {
	return &MembershipLevelUpdateLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 会员等级更新
func (l *MembershipLevelUpdateLogic) MembershipLevelUpdate(in *user.MembershipLevelUpdateRequest) (*user.MembershipLevelUpdateResponse, error) {
	dao.MembershipLevelUpdate(int32(in.Id), in.Name, int32(in.Grade), in.Description)
	return &user.MembershipLevelUpdateResponse{
		Msg: "会员等级更新成功",
	}, nil
}
